<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>添加菜单</title>
    <link rel="stylesheet" type="text/css" href="/static/hplus/css/bootstrap.min.css">
    <link rel="stylesheet" type="text/css" href="/static/hplus/css/plugins/iCheck/custom.css">
    <link rel="stylesheet" type="text/css" href="/static/hplus/css/style.css">
    <link rel="stylesheet" type="text/css" href="/static/layer/skin/layer.css">
    <style type="text/css">
        .form-control {width: 200px;}
        .col-sm-10 {width: 250px;display: inline-block;}
        .col-sm-2 {text-align: right;width: 125px;}
        .must {color: #ff0000;font-size: 19px;float: right;margin-left: 5px;}
    </style>
</head>
<body class="gray-bg">
<div class="wrapper wrapper-content animated fadeInRight">
    <div class="row">
        <div class="col-sm-12">
            <div class="ibox float-e-margins">
                <div class="ibox-title">
                    <h5>添加菜单</h5>
                </div>
                <div class="ibox-content">
                    <form class="form-horizontal" onsubmit="return false">
                        <div class="form-group">
                            <label class="col-sm-2 control-label">所属模块</label>
                            <div class="col-sm-10">
                                <select class="form-control" id="modular" name="modular">
                                    <option value="">…所属模块…</option>
                                    {foreach $mods as $item}
                                    <option value="{$item.id}">{$item.title}</option>
                                    {/foreach}
                                </select>
                            </div>
                        </div>
                        <div class="hr-line-dashed"></div>
                        <div class="form-group">
                            <label class="col-sm-2 control-label">父菜单</label>
                            <div class="col-sm-10">
                                <select class="form-control" id="pid" name="pid">
                                    <option value="">…父级菜单…</option>
                                </select>
                            </div>
                        </div>
                        <div class="hr-line-dashed"></div>
                        <div class="form-group">
                            <label class="col-sm-2 control-label">标识<span class="must">*</span></label>
                            <div class="col-sm-10">
                                <input type="text" class="form-control" id="identity" name="identity">
                            </div>
                        </div>
                        <div class="hr-line-dashed"></div>
                        <div class="form-group">
                            <label class="col-sm-2 control-label">名称<span class="must">*</span></label>
                            <div class="col-sm-10">
                                <input type="text" class="form-control" id="title" name="title">
                            </div>
                        </div>
                        <div class="hr-line-dashed"></div>
                        <div class="form-group">
                            <label class="col-sm-2 control-label">链接</label>
                            <div class="col-sm-10">
                                <input type="text" class="form-control" id="url" name="url">
                            </div>
                        </div>
                        <div class="hr-line-dashed"></div>
                        <div class="form-group">
                            <label class="col-sm-2 control-label">排序</label>
                            <div class="col-sm-10">
                                <input type="text" class="form-control" id="sort" name="sort" value="99">
                            </div>
                        </div>
                        <div class="hr-line-dashed"></div>
                        <div class="form-group">
                            <label class="col-sm-2 control-label">是否显示</label>
                            <div class="col-sm-10">
                                <div class="radio i-checks">
                                    <label class>
                                        <div class="iradio_square-green">
                                            <input type="radio" value="0" name="is_hide" style="position: absolute; opacity: 0;">
                                            <ins class="iCheck-helper"></ins>
                                        </div>
                                        显示</label>
                                    <label class>
                                        <div class="iradio_square-green">
                                            <input type="radio" value="1" name="is_hide" style="position: absolute; opacity: 0;">
                                            <ins class="iCheck-helper"></ins>
                                        </div>
                                        隐藏</label>
                                </div>
                            </div>
                        </div>
                    </form>
                </div>
            </div>
        </div>
    </div>
</div>
</body>
<script type="text/javascript" src="/static/hplus/js/jquery.min.js?v={php}echo time(){/php}"></script>
<script type="text/javascript" src="/static/hplus/js/plugins/iCheck/icheck.min.js?v={php}echo time(){/php}"></script>
<script type="text/javascript" src="/static/layer/layer.js?v={php}echo time(){/php}"></script>
<script type="text/javascript">
    $(function () {
        $(".i-checks").iCheck({checkboxClass: "icheckbox_square-green", radioClass: "iradio_square-green"});
        $('#modular').change(function () {
            $('#pid').html('<option value="">…父级菜单…</option>')
            let $mid = $(this).val()
            $.ajax({
                type: 'post', dataType: 'json', cache: false,
                url: '{:url("get_menu")}',
                data: {'mid': $mid},
                success: function ($data) {
                    if ($data.code === 200 && $data.data != null) {
                        let $str = '';
                        $($data.data).each(function (i, v) {
                            $str += '<option value="' + v.id + '">' + v.title + '</option>'
                        });
                        $('#pid').append($str);
                    }
                }
            })
        })
    });
</script>
</html>
